package com.example.shiwu.view;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Bitmap;
import android.view.View;
import android.widget.TextView;

import com.example.shiwu.MainInfoActivity;
import com.example.shiwu.R;
import com.example.shiwu.model.MainInfo;
import com.example.shiwu.util.BaseView;
import com.example.shiwu.util.StringUtil;

public class MainInfoView extends BaseView<MainInfo> {

    public TextView sn,edition,channel,powerSource,firmwareeDition,gps,outele,temp,voltage,intemp;
    public Activity contexts;
    public View views;

    public MainInfoView(Activity context, int layoutResId,View view) {
        super(context, layoutResId);
        contexts = context;
        views = view;
    }

    @SuppressLint("InflateParams")
    @Override
    public View createView() {

//        sn = views.findViewById(R.id.main_sn_val);
//        edition = views.findViewById(R.id.main_edition_val);
        temp = views.findViewById(R.id.main_status_temp_val);
        voltage=views.findViewById(R.id.main_status_voltage_val);
        intemp =views.findViewById(R.id.main_status_in_temp_val);
        channel = views.findViewById(R.id.main_channel_val);
        powerSource = views.findViewById(R.id.maininfo_power_source_val);
        firmwareeDition = views.findViewById(R.id.maininfo_firmwaree_dition_val);
        gps = views.findViewById(R.id.maininfo_gps_val);
        outele =  views.findViewById(R.id.maininfo_out_val);
        return super.createView();
    }

    @Override
    public void bindView(MainInfo data_) {
        super.bindView(data_ != null ? data_ : new MainInfo());

//        sn.setText(data.getSn());
//        edition.setText(data.getEdition());
        temp.setText(data.getTemp());
        voltage.setText(data.getVoltage());
        intemp.setText(data.getIntemp());

        channel.setText(data.getChannel());
        powerSource.setText(data.getPowerSource());
        firmwareeDition.setText(data.getFirmwareeDition());
        gps.setText(data.getGps());
        outele.setText(data.getOutEle());
    }
}
